

export function comjs(app) {
	
	 
	
	app.config.globalProperties.topay = (url) => {
	  // #ifdef APP-PLUS
		  uni.reLaunch({
			url: `/pages/web-view?url=` + url
		  })
	  // #endif
	  // #ifdef H5
		location.href = url;
	  // #endif
	}
	
	app.config.globalProperties.qidai=()=>{
		uni.showToast({
			title:"敬请期待",
			icon:"none"
		})
	}
	app.config.globalProperties.thistime = () => {
		 
		 const now = new Date();
		 const year = now.getFullYear();
		 const month = now.getMonth() + 1;
		 const day = now.getDate();
		 const hour = now.getHours();
		 const minute = now.getMinutes();
		 const second = now.getSeconds();
		return year+'/'+month+'/'+ day +' '  +hour +':'+ minute +':'+second
	}
	

	
 

	app.config.globalProperties.navto=(url)=>{
		uni.navigateTo({
			url
		})
	}
	app.config.globalProperties.shh = uni.getSystemInfoSync().statusBarHeight
	
	
	app.config.globalProperties.istime = (time,newsp) => {
		if (time) {	
			var times = time.replace(/-/g, '/');
			// var newtime = newsp.replace(/-/g, '/');
			if (new Date(times).getTime() - new Date().getTime() > 0) {
				return true //没到
			} else {
				return false
			}
		}
		
	}
	app.config.globalProperties.copy = (copy)=>{
		uni.setClipboardData({
			data: copy,
			success: function () {
				uni.showToast({
					title: '复制成功',
					icon: 'none',
				});
			}
		})
	}
	app.config.globalProperties.hao = (number) => {
	  number = number + ''
	  var ac = number.length == 1 ? '0000' + number : number.length == 2 ? '000' + number : number.length == 3 ? '00' +
	  	number : number.length == 4 ? '0' + number : number
	   return ac
	},
	app.config.globalProperties.back = () => {
		if (getCurrentPages().length == 1) {
			uni.reLaunch({
				url: "/pages/index/index"
			})
		} else {
			uni.navigateBack()
		}
	}

}
